﻿using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using NHibernateSample.Domain.Entities;
namespace NHibernateSample.Data.Test
{
    [TestFixture]
    public class OrderManageFixture
    {
        private OrderManage orderManage;
        private CustomerManage customerManage;
        [TestFixtureSetUp]
        public void TestFixtureSetup()
        {
            orderManage = new OrderManage();
            customerManage = new CustomerManage();
        }
        [Test]
        public void GetCustomerByIdTest()
        {
            var order = new Order();
            order.Customer = customerManage.GetCustomerById(1);
            order.OrderDate = DateTime.Now;
            
            orderManage.SaveOrder(order);

            Order orderGotten = orderManage.GetOrderByID(order.OrderId);
            //Customer customer = orderManage.GetCustomerById(1);
            //int customerId = customer.Id;
            Assert.AreEqual(order.OrderId, orderGotten.OrderId);
        }
    }
}
